## API Report File for "@backstage/core-plugin-api"

> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).

```ts
import { ApiRef } from '@backstage/core-plugin-api';
import { Observable } from '@backstage/types';
import { TranslationMessages as TranslationMessages_2 } from '@backstage/core-plugin-api/alpha';
import { TranslationRef as TranslationRef_2 } from '@backstage/core-plugin-api/alpha';

// @alpha (undocumented)
export type AppLanguageApi = {
  getAvailableLanguages(): {
    languages: string[];
  };
  setLanguage(language?: string): void;
  getLanguage(): {
    language: string;
  };
  language$(): Observable<{
    language: string;
  }>;
};

// @alpha (undocumented)
export const appLanguageApiRef: ApiRef<AppLanguageApi>;

// @alpha
export function createTranslationMessages<
  TId extends string,
  TMessages extends {
    [key in string]: string;
  },
  TFull extends boolean,
>(
  options: TranslationMessagesOptions<TId, TMessages, TFull>,
): TranslationMessages<TId, TMessages, TFull>;

// @alpha (undocumented)
export function createTranslationRef<
  TId extends string,
  const TNestedMessages extends AnyNestedMessages,
  TTranslations extends {
    [language in string]: () => Promise<{
      default: {
        [key in keyof FlattenedMessages<TNestedMessages>]: string | null;
      };
    }>;
  },
>(
  config: TranslationRefOptions<TId, TNestedMessages, TTranslations>,
): TranslationRef<TId, FlattenedMessages<TNestedMessages>>;

// @alpha (undocumented)
export function createTranslationResource<
  TId extends string,
  TMessages extends {
    [key in string]: string;
  },
  TTranslations extends {
    [language in string]: () => Promise<{
      default:
        | TranslationMessages_2<TId>
        | {
            [key in keyof TMessages]: string | null;
          };
    }>;
  },
>(
  options: TranslationResourceOptions<TId, TMessages, TTranslations>,
): TranslationResource<TId>;

// @alpha (undocumented)
export type TranslationApi = {
  getTranslation<
    TMessages extends {
      [key in string]: string;
    },
  >(
    translationRef: TranslationRef<string, TMessages>,
  ): TranslationSnapshot<TMessages>;
  translation$<
    TMessages extends {
      [key in string]: string;
    },
  >(
    translationRef: TranslationRef<string, TMessages>,
  ): Observable<TranslationSnapshot<TMessages>>;
};

// @alpha (undocumented)
export const translationApiRef: ApiRef<TranslationApi>;

// @alpha (undocumented)
export interface TranslationFunction<
  TMessages extends {
    [key in string]: string;
  },
> {
  // (undocumented)
  <TKey extends keyof CollapsedMessages<TMessages>>(
    key: TKey,
    ...[args]: TranslationFunctionOptions<
      NestedMessageKeys<TKey, CollapsedMessages<TMessages>>,
      PluralKeys<TMessages>,
      CollapsedMessages<TMessages>
    >
  ): CollapsedMessages<TMessages>[TKey];
}

// @alpha
export interface TranslationMessages<
  TId extends string = string,
  TMessages extends {
    [key in string]: string;
  } = {
    [key in string]: string;
  },
  TFull extends boolean = boolean,
> {
  // (undocumented)
  $$type: '@backstage/TranslationMessages';
  full: TFull;
  id: TId;
  messages: TMessages;
}

// @alpha
export interface TranslationMessagesOptions<
  TId extends string,
  TMessages extends {
    [key in string]: string;
  },
  TFull extends boolean,
> {
  // (undocumented)
  full?: TFull;
  // (undocumented)
  messages: false extends TFull
    ? {
        [key in keyof TMessages]?: string | null;
      }
    : {
        [key in keyof TMessages]: string | null;
      };
  // (undocumented)
  ref: TranslationRef_2<TId, TMessages>;
}

// @alpha (undocumented)
export interface TranslationRef<
  TId extends string = string,
  TMessages extends {
    [key in string]: string;
  } = {
    [key in string]: string;
  },
> {
  // (undocumented)
  $$type: '@backstage/TranslationRef';
  // (undocumented)
  id: TId;
  // (undocumented)
  T: TMessages;
}

// @alpha (undocumented)
export interface TranslationRefOptions<
  TId extends string,
  TNestedMessages extends AnyNestedMessages,
  TTranslations extends {
    [language in string]: () => Promise<{
      default: {
        [key in keyof FlattenedMessages<TNestedMessages>]: string | null;
      };
    }>;
  },
> {
  // (undocumented)
  id: TId;
  // (undocumented)
  messages: TNestedMessages;
  // (undocumented)
  translations?: TTranslations;
}

// @alpha (undocumented)
export interface TranslationResource<TId extends string = string> {
  // (undocumented)
  $$type: '@backstage/TranslationResource';
  // (undocumented)
  id: TId;
}

// @alpha (undocumented)
export interface TranslationResourceOptions<
  TId extends string,
  TMessages extends {
    [key in string]: string;
  },
  TTranslations extends {
    [language in string]: () => Promise<{
      default:
        | TranslationMessages_2<TId>
        | {
            [key in keyof TMessages]: string | null;
          };
    }>;
  },
> {
  // (undocumented)
  ref: TranslationRef_2<TId, TMessages>;
  // (undocumented)
  translations: TTranslations;
}

// @alpha (undocumented)
export type TranslationSnapshot<
  TMessages extends {
    [key in string]: string;
  },
> =
  | {
      ready: false;
    }
  | {
      ready: true;
      t: TranslationFunction<TMessages>;
    };

// @alpha (undocumented)
export const useTranslationRef: <
  TMessages extends {
    [x: string]: string;
  },
>(
  translationRef: TranslationRef<string, TMessages>,
) => {
  t: TranslationFunction<TMessages>;
};

// (No @packageDocumentation comment for this package)
```
